<template>
  <div>
    <h1>App组件</h1>
    <button @click="copm = 'Game'">游戏</button>
    <button @click="copm = 'News'">新闻</button>
    <button @click="copm = 'Movie'">电影</button>

    <!-- 缓存组件 不会销毁 -->
    <keep-alive>
      <component :is="copm"></component>
    </keep-alive>
  </div>
</template>

<script>
import Game from "@/components/Game";
import Movie from "./components/Movie";
import News from "@/components/News";
export default {
  name: "App",
  components: {
    Game,
    Movie,
    News,
  },
  data() {
    return {
      copm: "",
    };
  },
};
</script>

<style></style>
